<page-header title="'Stack details'" breadcrumbs="[{label:'Stacks', link:'docker.stacks'}, stackName]" reload="true"> </page-header>

<div class="row">
  <div class="col-sm-12">
    <rd-widget>
      <rd-widget-body>
        <uib-tabset active="state.activeTab">
          <!-- tab-info -->
          <uib-tab index="0">
            <uib-tab-heading>
              <pr-icon icon="'list'"></pr-icon>
              Stack
            </uib-tab-heading>
            <stack-info-tab
              stack="stack"
              stack-name="stackName"
              stack-file-content="stackFileContent"
              is-regular="regular"
              is-external="external"
              is-orphaned="orphaned"
              is-orphaned-running="orphanedRunning"
              environment-id="endpoint.Id"
              yaml-error="yamlError"
            ></stack-info-tab>
          </uib-tab>
          <!-- !tab-info -->
          <!-- tab-file -->
          <uib-tab index="1" select="showEditor()" ng-if="!external && (!stack.GitConfig || stack.FromAppTemplate)">
            <uib-tab-heading>
              <pr-icon icon="'edit-2'" class-name="'mr-1'"></pr-icon>
              Editor
            </uib-tab-heading>
            <stack-editor-tab
              ng-if="state.showEditorTab"
              stack-type="stackType"
              compose-syntax-max-version="composeSyntaxMaxVersion"
              is-orphaned="orphaned"
              initial-values="editorTabInitialValues"
              container-names="containerNames"
              original-container-names="state.originalContainerNames"
              versions="state.versions"
              stack-id="stack.Id"
              on-submit="(deployStack)"
              on-submit-settled="(onEditorSubmitSettled)"
            ></stack-editor-tab>
          </uib-tab>
          <!-- !tab-file -->
        </uib-tabset>
      </rd-widget-body>
    </rd-widget>
  </div>
</div>

<stack-containers-datatable
  ng-if="stackType !== STACK_TYPES.DockerSwarm && (!orphaned || orphanedRunning)"
  stack-name="stackName"
  environment="endpoint"
></stack-containers-datatable>

<docker-services-datatable
  ng-if="services && (!orphaned || orphanedRunning)"
  dataset="services"
  title-icon="list"
  on-refresh="(getServices)"
  table-key="'stack-services'"
></docker-services-datatable>

<!-- access-control-panel -->
<access-control-panel
  ng-if="stack && !orphaned"
  resource-id="stack.EndpointId + '_' + stack.Name"
  resource-control="stack.ResourceControl"
  resource-type="resourceType"
  environment-id="stack.EndpointId"
  on-update-success="(onUpdateResourceControlSuccess)"
>
</access-control-panel>
<!-- !access-control-panel -->
